﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 游戏平台原型
{
    public class Room
    {
        public long roomid;//房间号
        public string roomname;//房间名称
        public string password;//房间密码
        public Room next;//下一个房间
        public long ownerid;//房间所属
        public int maxperson;//最大人数
        public int maxpanel;//最大画板数
        public Chat chat;//聊天室
        public Linklist onlinelist;//在线列表
        public Panel[] panel = new Panel[6];//画板列表
        private Panel head; //单链表的头结点

        public Room(long newroomid, string newroomname, string newpassword, long newownerid, int newmaxperson, int newmaxpanel)
        {
            roomid = newroomid;
            roomname = newroomname;
            password = newpassword;
            ownerid =newownerid;
            maxperson =newmaxperson;
            maxpanel = newmaxpanel;
            onlinelist = new Linklist();
            next = null;
        }
        public Room()
        {
            next = null;
            head = null;
        }
        public void AddPanel(int id,string type)
        {
            panel[id] = new Panel(id,type);
            Panel currentpanel = panel[id];
        }
        public long PanelCount()
        {
            Panel p = head;
            long len = 0;
            while (p != null)
            {
                ++len;
                p = p.next;
            }
            return len;
        }
    }
}